import request from '@/config/axios'

// 下载历史 VO
export interface DownloadHistoryVO {
  id: number // 主键
  fileId: number // 文件ID
  fileName: string // 文件名
  userId: number // 用户ID
  userName: number // 用户名
}

// 下载历史 API
export const DownloadHistoryApi = {
  // 查询下载历史分页
  getDownloadHistoryPage: async (params: any) => {
    return await request.get({ url: `/infra/download-history/page`, params })
  },

  // 查询下载历史详情
  getDownloadHistory: async (id: number) => {
    return await request.get({ url: `/infra/download-history/get?id=` + id })
  },

  // 新增下载历史
  createDownloadHistory: async (data: DownloadHistoryVO) => {
    return await request.post({ url: `/infra/download-history/create`, data })
  },

  // 修改下载历史
  updateDownloadHistory: async (data: DownloadHistoryVO) => {
    return await request.put({ url: `/infra/download-history/update`, data })
  },

  // 删除下载历史
  deleteDownloadHistory: async (id: number) => {
    return await request.delete({ url: `/infra/download-history/delete?id=` + id })
  },

  // 导出下载历史 Excel
  exportDownloadHistory: async (params) => {
    return await request.download({ url: `/infra/download-history/export-excel`, params })
  }
}